package org.gss

scenario "Creating a css style sheet", {
    given "A stylesheet with body, .header, and .footer declarations", {
	styleSheet = new StyleSheet(
	    body:"body".css(
		height:600.px
	    ),
	    footer:".footer".css(
		height:10.percent
	    ),
	    header:".header".css(
		height:100.px
	    )
	)
    }
    then "The string representation should be", {
	(styleSheet.toString() ==~ /(.|\n)*\.footer\{\n.*height:10%;\n\}(.|\n)*/).shouldBe true
	styleSheet = null
    }
    
}

scenario "Using rgb values", {
    given "A stylesheet with a declaration that uses an rgb value", {
	styleSheet = new StyleSheet(
	    body:"body".css(
		color:rgb(100,100,100)
	    )
	)
    }
    then "The string representation should be", {
	styleSheet.body.color.toString().shouldBe "color:rgb(100,100,100);"
	styleSheet = null
    }
}

scenario "Using hex values", {
    given "A stylesheet with a declaration that uses an hex value w/o the # sign", {
	styleSheet = new StyleSheet(
	    body:"body".css(
		color:hex("BEEFEE")
	    )
	)
    }
    then "The string representation should be", {
	styleSheet.body.color.toString().shouldBe "color:#BEEFEE;"
	styleSheet = null
    }
    given "A stylesheet with a declaration that uses an hex value w/ the # sign", {
	styleSheet = new StyleSheet(
	    body:"body".css(
		color:hex("#BEEFEE")
	    )
	)
    }
    then "The string representation should be", {
	styleSheet.body.color.toString().shouldBe "color:#BEEFEE;"
	styleSheet = null
    }
}

scenario "Using octal values", {
    given "A stylesheet with a declaration that uses an octal value w/o the # sign", {
	styleSheet = new StyleSheet(
	    body:"body".css(
		color:octal("ABC")
	    )
	)
    }
    then "The string representation should be", {
	styleSheet.body.color.toString().shouldBe "color:#ABC;"
	styleSheet = null
    }
    given "A stylesheet with a declaration that uses an octal value w/ the # sign", {
	styleSheet = new StyleSheet(
	    body:"body".css(
		color:octal("#XYZ")
	    )
	)
    }
    then "The string representation should be", {
	styleSheet.body.color.toString().shouldBe "color:#XYZ;"
	styleSheet = null
    }
}

scenario "Adding a border", {
    given "A stylesheet with a 'border:1px solid rgb(20,20,20);' declaration", {
	styleSheet = new StyleSheet(
	    body:"body".css(
		border:border(1.px,"solid",rgb(20,20,20))
	    )
	)
    }
    then "The string representation should be", {
	styleSheet.body.border.toString().shouldBe "border:1px solid rgb(20,20,20);"
	styleSheet = null
    }
}